import md5
from django import template
from django.contrib.auth.models import User

register = template.Library()

def gravatar(value):
    encoded_email = md5.new(value).hexdigest()
    return "http://www.gravatar.com/avatar.php?gravatar_id=\
                %sx&size=32&rating=PG" % encoded_email
                
register.filter('gravatar', gravatar)